import unittest
from ddt import ddt,data,unpack

data1 = ["123","345"]
data2 = {"username":"allen","password":"123456"}
data3 = [{"username":"allen","password":"123456"},{"username":"allen1","password":"1234"}]

@ddt()
class TestDemo(unittest.TestCase):
    @data(*data1)    #元组去括号
    def test_print_data1(self,item):
        print(item)


    @data(data2)
    @unpack  #字典去括号
    def test_print_data2(self,username,password):
        print(username,password)

    @data(*data3)
    @unpack
    def test_print_data3(self,username,password):
        print(username,password)

if __name__ == '__main__':
    unittest.main()
